package com.leyou.common.exceptions;

import com.leyou.common.enums.ExceptionEnum;
import lombok.Getter;

/**
 * @author xiuer
 * @version V1.0.0
 * @package com.leyou.common.exceptions
 * @description 自定义异常，来接受状态码、异常消息
 * @date 2019/6/22 19:20
 */
@Getter
public class LyException extends RuntimeException {
    /**
     * 异常状态码
     */
    private int status;

    public LyException(ExceptionEnum em) {
        super(em.getMessage());
        this.status = em.getStatus();
    }

    public LyException(ExceptionEnum em, Throwable cause) {
        super(em.getMessage(), cause);
        this.status = em.getStatus();
    }

    public LyException(int status, String message) {
        super(message);
        this.status = status;
    }

    public LyException(int status, String message, Throwable cause) {
        super(message, cause);
        this.status = status;
    }

}
